//
//  CashierViewController.m
//  LvBao
//
//  Created by 范琦 on 16/6/8.
//  Copyright © 2016年 范琦. All rights reserved.
//

#import "CashierViewController.h"
#import "OrderDetailTopCell.h"
#import "OrderDetailCell.h"
#import "CashierCell.h"

@interface CashierViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation CashierViewController
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = NO;
    [[self rdv_tabBarController] setTabBarHidden:YES animated:YES];
    [self creatTableView];
    
}

- (void)creatTableView
{
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, KSCREENWIDTH, KSCREENHEIGHT) style:UITableViewStyleGrouped];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    [self.view addSubview:_tableView];
    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    [_tableView registerNib:[UINib nibWithNibName:@"OrderDetailTopView" bundle:nil] forCellReuseIdentifier:@"cell1"];
    [_tableView registerNib:[UINib nibWithNibName:@"CashierCell" bundle:nil] forCellReuseIdentifier:@"cell2"];

    _tableView.sectionFooterHeight = 0;
    _tableView.backgroundColor = [UIColor huiseColor];
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KSCREENWIDTH, 100)];
    
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(30, 40, KSCREENWIDTH - 60, 40);
    button.backgroundColor = [UIColor redColor];
    [button setTitle:@"确认支付" forState:UIControlStateNormal];
    button.tintColor = [UIColor whiteColor];
    button.layer.cornerRadius = 20;
    button.layer.masksToBounds = YES;
    button.titleLabel.font = [UIFont systemFontOfSize:20];
    [view addSubview:button];
    [button addTarget:self action:@selector(enter) forControlEvents:UIControlEventTouchUpInside];
    _tableView.tableFooterView = view;
}
- (void)enter
{


}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0) {
        return 1;
    }else{
        return 1;
    }

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        return 100;
    }else{
        return 45;
    }
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 20;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        OrderDetailTopCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }
    else {
        CashierCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell2"];
      
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return cell;
    }
    }


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
